package com.eascs.continueloan.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.eascs.common.util.UrlUtil;
import com.eascs.continueloan.entity.O2oContinueFormEntity;
import com.eascs.continueloan.service.O2oContinueLoanService;
import com.eascs.notice.controller.NoticeBaseMasterController;
import com.eascs.site.view.ViewContext;
import com.eascs.tag.MenuTag;

@Controller
@RequestMapping("/cloan")
public class O2oContinueController  extends NoticeBaseMasterController{

	@Autowired
	O2oContinueLoanService continueLoanService;
	
	@Override
	public void preHandle() {
		super.preHandle();
		ViewContext.put(MenuTag.CURRENT_MENU_CODE, "continueLoan");
	}
	
	@RequestMapping("/index")
	public String index(O2oContinueFormEntity entity){
		String o2ourl = "/rcloan/o2o";
		if (entity != null) {
			String userName = entity.getUserName() == null ? "" : entity.getUserName();
			String userIdCard = entity.getUserIdCard() == null ? "" : entity.getUserIdCard();
			String billCode = entity.getBillCode() == null ? "" : entity.getBillCode();
			o2ourl = UrlUtil.appendUrl(o2ourl, "billCode", billCode);
			o2ourl = UrlUtil.appendUrl(o2ourl, "userName", userName);
			o2ourl = UrlUtil.appendUrl(o2ourl, "userIdCard", userIdCard);
			o2ourl = o2ourl + "&o2oIndex=";
		} else {
			o2ourl = o2ourl + "?o2oIndex=";
		}
		ViewContext.put("o2ourl", o2ourl);
		ViewContext.put("vo", entity);
		return "continueloan/index";
	}
	
}
